﻿<div ng-controller="consumeItemController">
    <div class="wrapper border-bottom white-bg page-heading">
        <div class="col-lg-pull-12">
            <ol class="breadcrumb">
                <li><a href="javascript:void(0)" ng-click="consumeProduct_list()">商品兑换</a></li>
                <li class="active" ng-bind="breadcrumb"></li>
            </ol>
        </div>
    </div>
    <form name="_form" class="form-horizontal w5c-form" w5c-form-validate="model.validateOptions" role="form" novalidate>
        <div class="form-group form-group-sm">
            <label class="col-sm-2 control-label">商品名称</label>
            <div class="col-sm-3">
                <input type="text" name="title" class="form-control " ng-model="model.title" ng-maxlength="35" placeholder="请输入商品名称" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">图片</label>
            <div class="col-sm-5">
                <input name="logo_url" type="file" ngf-select ng-model="model.file" accept="image/*" class="form-control input-sm">
                <img ng-src="{{site.img_url+model.img_url}}" class="img-thumbnail" ng-show="model.img_url" width="60" height="80">
            </div>
            <div class="col-sm-5 form-control-static">
                <span style="color:#d3d3d3">上传图片建议尺寸为：375px*375px！</span>
            </div>
        </div>
        <div class="form-group form-group-sm">
            <label class="col-sm-2 control-label">说明</label>
            <div class="col-sm-10">
                <textarea keditor="editConfig" id="ConsumeItem" name="detail" class="form-control input-sm" ng-model="model.detail" rows="4" w5c-dynamic-element ng-change="textAreaChanged(200)" required></textarea>
                <span ng-show="_form.description.$invalid && !_form.description.$pristine" class="w5c-error">请填写商品说明</span>
                <span class="help-block" id="textcount">0/200</span>
            </div>
        </div>
        <div class="form-group" style="display:none">
            <label class="col-sm-2 control-label">红钻兑换数量</label>
            <div class="col-sm-3">
                <input type="number" name="red_drill" class="form-control input-sm" ng-model="model.sale_price*token_setting.exchange_rate" min="0" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">兑换价</label>
            <div class="col-sm-3">
                <input type="number" name="sale_price" class="form-control input-sm" ng-model="model.sale_price" min="0" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">销售价</label>
            <div class="col-sm-3">
                <input type="number" name="market_price" class="form-control input-sm" ng-model="model.market_price" min="0" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">商品剩余可兑换数量</label>
            <div class="col-sm-5">
                <input type="number" name="product_num_limit" class="form-control input-sm" ng-model="model.product_num_limit" min="0" step="1" placeholder="为空则不限制">
            </div>
        </div>
        <div class="form-group form-group-sm">
            <label class="col-sm-2 control-label">开始兑换时间</label>
            <div class="col-sm-3">
                <div datetime class="input-group date">
                    <input class="form-control input-sm" ng-model="model.begin_time">
                    <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                </div>
            </div>
        </div>
        <div class="form-group form-group-sm">
            <label class="col-sm-2 control-label">状态</label>
            <div class="col-sm-2">
                <select name="status" class="form-control input-sm" ng-model="model.status_value" required>
                    <option ng-repeat="x in model.e_status_list" value="{{x.value}}">{{x.text}}</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">排序（降序排序）</label>
            <div class="col-sm-3">
                <input type="number" name="sort" class="form-control input-sm" ng-model="model.sort" required>
            </div>
        </div>
        <div class="form-group form-group-sm">
            <label class="col-sm-2 control-label"></label>
            <div class="col-sm-3">
                <button type="submit" w5c-form-submit="saveConsumeProduct()" class="btn btn-primary btn-sm" btn-loading="psdisabled.save" loading-text="保存中..." ng-disabled="psdisabled.save">
                    <i class="fa fa-save"></i> 保存
                </button>
                <button ng-click="consumeProduct_list()" class="btn btn-primary btn-sm"><i class="fa fa-rotate-left"></i> 取消</button>
            </div>
        </div>
    </form>
</div>